<?php

/**
 * BonEnterFoire form base class.
 *
 * @method BonEnterFoire getObject() Returns the current form's model object
 *
 * @package    SdCommerce
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseBonEnterFoireForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                  => new sfWidgetFormInputHidden(),
      'id_foire'            => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Foire'), 'add_empty' => false)),
      'bon_sortie_id'       => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('BonSortie'), 'add_empty' => false)),
      'reference'           => new sfWidgetFormInputText(),
      'ref_bon_sorti_foire' => new sfWidgetFormInputText(),
      'date_creation'       => new sfWidgetFormDate(),
      'date_validite'       => new sfWidgetFormDate(),
      'observation'         => new sfWidgetFormTextarea(),
      'created_at'          => new sfWidgetFormDateTime(),
      'updated_at'          => new sfWidgetFormDateTime(),
      'deleted_at'          => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'                  => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'id_foire'            => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Foire'))),
      'bon_sortie_id'       => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('BonSortie'))),
      'reference'           => new sfValidatorString(array('max_length' => 20)),
      'ref_bon_sorti_foire' => new sfValidatorString(array('max_length' => 100, 'required' => false)),
      'date_creation'       => new sfValidatorDate(array('required' => false)),
      'date_validite'       => new sfValidatorDate(array('required' => false)),
      'observation'         => new sfValidatorString(array('max_length' => 1000, 'required' => false)),
      'created_at'          => new sfValidatorDateTime(),
      'updated_at'          => new sfValidatorDateTime(),
      'deleted_at'          => new sfValidatorDateTime(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('bon_enter_foire[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'BonEnterFoire';
  }

}
